package lx.service.Impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import lx.dao.UserDao;
import lx.entity.User;
import lx.service.UserService;

@Service      //表示是也业务层组件  ，没命名就是userService,可以命名@Service("myService")
public class UserServiceImpl implements UserService{
	@Autowired  //从容器自动注入（对象，属性，参数）
	private UserDao usi;
 
	public List<User> findAll() {
		// TODO Auto-generated method stub
		return usi.findAll();
	}
 
	public boolean save(User u) {
		// TODO Auto-generated method stub
		int a=usi.save(u);
		if(a==1){
			return true;
		}else{
			return false;
		}
	}
 
	public boolean delete(int id) {
		// TODO Auto-generated method stub
		int a=usi.delete(id);
		if(a==1){
			return true;
		}else{
			return false;
		}
	}
 
	public boolean update(User u) {
		// TODO Auto-generated method stub
		int a=usi.update(u);
		if(a==1){
			return true;
		}else{
			return false;
		}
	}
 
	public User findById(int id) {
		// TODO Auto-generated method stub
		return usi.findById(id);
	}
	
}